<?php
    @include_once("./conn.php");  //链接数据库
    @header('Access-Control-Allow-Origin:*');
    $user = $_POST["user"];
    $pwd = $_POST["pwd"];
    $result =  mysqli_query($conn,"select * from `register` where user = '$user'");
   
    $item = mysqli_fetch_assoc($result);
    
    $obj = array();
    if($item){ // 有数据
        if($pwd == $item["pwd"]){
            $obj["status"] = true;
            $obj["detail"] = "登录成功";
        }else{
            $obj["status"] = false;
            $obj["detail"] = "用户名或密码有误";
        }
    }else{ // 没有数据
        $obj["status"] = false;
        $obj["detail"] = "用户未注册";
    }

    echo json_encode($obj);
?>